Skip to content

perf(ds4): reuse F16 KV in fused verification - #632

Merged
davide221 merged 3 commits into
Luce-Org:mainfrom
pepuscz:perf/ds4-fused-explicit-f16-kv
Aug 19, 2026
Merged

perf(ds4): reuse F16 KV in fused verification#632
davide221 merged 3 commits into
Luce-Org:mainfrom
pepuscz:perf/ds4-fused-explicit-f16-kv

Conversation

@pepuscz

@pepuscz pepuscz commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Add an opt-in --ds4-fused-verify-f16-kv path for single-device HIP DeepSeek V4 verification.

The existing explicit batched verifier converts the complete persistent F16 MLA cache to F32 on every speculative step. This path feeds the same raw and compressed rows directly from the F16 cache into the established explicit attention topology. It keeps F32 key-side accumulation through 512 attention rows to protect the short-context baseline, then avoids the full-cache conversion at longer contexts.

The attended row set, masks, and explicit attention operation order are unchanged. The option remains off by default and is rejected by the feature gate outside a monolithic HIP DeepSeek V4 backend. It can still change generated tokens because the verifier inputs are F16.

Published qualification patches:

Matched benchmark

Ryzen AI Max+ 395 / Radeon 8060S, ROCm 7.1.1, 100/100/100 W package limits, fixed-high GPU policy, ROCmFPX target, Q4RMFP4 DSpark draft, all six experts, q=4 fused verification, Q4_0 K/V. Each comparison used the same prompt and power policy.

Input Path Prefill Decode Retrieval Acceptance
4,096 F32-cache conversion control 137.79 tok/s 26.7 tok/s 5/5 1.00
4,096 F16 cache reuse 138.71 tok/s 27.5 tok/s 5/5 1.00
59,933 F32-cache conversion control 123.24 tok/s 16.4 tok/s 5/5 1.00
59,933 F16 cache reuse 123.20 tok/s 22.5 tok/s 5/5 1.00

The long-context decode gain is 37.2%; prefill is unchanged within run variance. A production composition including this path and the same 512-row F32 cutoff later passed 122,879-token 5/5 retrieval, 1.00 acceptance, and the 30/30 quality gate. The deployment-specific adaptive-prefill and graph-cache limits from that composition are intentionally not part of this PR.

Reproduction setup and benchmark definitions: https://github.com/pepuscz/strix-halo-deepseek-v4-flash

Validation

  • Added placement feature-gate coverage; the pure feature-gate binary passes locally
  • git diff --check
  • The qualified ROCm 7.1.1 source composition built successfully and passed 353/354 server tests; the sole failure was the pre-existing MoeHybridStorageFixture::fractional_route_quota_rounds_over_the_batch expectation

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/src/deepseek4/deepseek4_internal.h
Comment thread server/src/deepseek4/deepseek4_graph.cpp
Comment thread server/src/deepseek4/deepseek4_backend.cpp

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/src/deepseek4/deepseek4_backend.cpp
@davide221

Copy link
Copy Markdown
Contributor

looks good to me

@davide221
davide221 merged commit d03bcc4 into Luce-Org:main Aug 19, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants